<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Date</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            Date 
            
                <span class="parent">&lt; 
                    
                    <a href="Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/date/acts_like_rb.html">activesupport/lib/active_support/core_ext/date/acts_like.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/date/calculations_rb.html">activesupport/lib/active_support/core_ext/date/calculations.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/date/conversions_rb.html">activesupport/lib/active_support/core_ext/date/conversions.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/date/zones_rb.html">activesupport/lib/active_support/core_ext/date/zones.rb</a></li>
            
            <li><a href="../files/activesupport/lib/active_support/json/encoding_rb.html">activesupport/lib/active_support/json/encoding.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>#</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-3C-3D-3E">&lt;=&gt;</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>A</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-acts_like_date-3F">acts_like_date?</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-advance">advance</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-ago">ago</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-at_beginning_of_day">at_beginning_of_day</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-at_end_of_day">at_end_of_day</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-at_midnight">at_midnight</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>B</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-beginning_of_day">beginning_of_day</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-c-beginning_of_week">beginning_of_week</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-c-beginning_of_week-3D">beginning_of_week=</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-change">change</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-compare_with_coercion">compare_with_coercion</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-compare_without_coercion">compare_without_coercion</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-c-current">current</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-default_inspect">default_inspect</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-end_of_day">end_of_day</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>F</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-c-find_beginning_of_week-21">find_beginning_of_week!</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-in">in</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-in_time_zone">in_time_zone</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-inspect">inspect</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>M</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-midnight">midnight</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>R</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-readable_inspect">readable_inspect</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-since">since</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-to_default_s">to_default_s</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-to_formatted_s">to_formatted_s</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-to_s">to_s</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-to_time">to_time</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-i-to_time_in_current_zone">to_time_in_current_zone</a>,
              </li>
            
              
              <li>
                <a href="Date.html#method-c-tomorrow">tomorrow</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>X</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-i-xmlschema">xmlschema</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>Y</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Date.html#method-c-yesterday">yesterday</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  
    <!-- Includes -->
    <div class="sectiontitle">Included Modules</div>
    <ul>
      
        <li>
          
            <a href="DateAndTime/Calculations.html">
              DateAndTime::Calculations
            </a>
          
        </li>
      
    </ul>
  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">DATE_FORMATS</td>
            <td>=</td>
            <td class="attr-value">{
:short        =&gt; '%e %b',
:long         =&gt; '%B %e, %Y',
:db           =&gt; '%Y-%m-%d',
:number       =&gt; '%Y%m%d',
:long_ordinal =&gt; lambda { |date|
day_format = ActiveSupport::Inflector.ordinalize(date.day)
date.strftime(&quot;%B #{day_format}, %Y&quot;) # =&gt; &quot;April 25th, 2007&quot;
},
:rfc822       =&gt; '%e %b %Y'
}</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    
      <!-- Section attributes -->
      <div class="sectiontitle">Attributes</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>beginning_of_week_default</td>
            <td class='attr-desc'></td>
          </tr>
        
      </table>
    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-beginning_of_week">
            
              <b>beginning_of_week</b>()
            
            <a href="Date.html#method-c-beginning_of_week" name="method-c-beginning_of_week" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the week start (e.g. :monday) for the current request, if this has
been set (via <a
href="Date.html#method-c-beginning_of_week-3D">::beginning_of_week=</a>).
If <code>Date.beginning_of_week</code> has not been set for the current
request, returns the week start specified in
<code>config.beginning_of_week</code>. If no config.beginning_of_week was
specified, returns :monday.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-beginning_of_week_source')" id="l_method-c-beginning_of_week_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L17" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-beginning_of_week_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 17</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">beginning_of_week</span>
  <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value">:beginning_of_week</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">beginning_of_week_default</span> <span class="ruby-operator">||</span> <span class="ruby-value">:monday</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-beginning_of_week-3D">
            
              <b>beginning_of_week=</b>(week_start)
            
            <a href="Date.html#method-c-beginning_of_week-3D" name="method-c-beginning_of_week-3D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Sets <code>Date.beginning_of_week</code> to a week start (e.g. :monday) for
current request/thread.</p>

<p>This method accepts any of the following day symbols: :monday, :tuesday,
:wednesday, :thursday, :friday, :saturday, :sunday</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-beginning_of_week-3D_source')" id="l_method-c-beginning_of_week-3D_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L25" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-beginning_of_week-3D_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 25</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">beginning_of_week=</span>(<span class="ruby-identifier">week_start</span>)
  <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-value">:beginning_of_week</span>] = <span class="ruby-identifier">find_beginning_of_week!</span>(<span class="ruby-identifier">week_start</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-current">
            
              <b>current</b>()
            
            <a href="Date.html#method-c-current" name="method-c-current" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns <a href="Time.html#method-c-zone">Time.zone</a>.today when
<code>Time.zone</code> or <code>config.time_zone</code> are set, otherwise
just returns Date.today.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-current_source')" id="l_method-c-current_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L46" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-current_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current</span>
  <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span> <span class="ruby-operator">?</span> <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span>.<span class="ruby-identifier">today</span> <span class="ruby-operator">:</span> <span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">today</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-find_beginning_of_week-21">
            
              <b>find_beginning_of_week!</b>(week_start)
            
            <a href="Date.html#method-c-find_beginning_of_week-21" name="method-c-find_beginning_of_week-21" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns week start day symbol (e.g. :monday), or raises an ArgumentError
for invalid day symbol.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-find_beginning_of_week-21_source')" id="l_method-c-find_beginning_of_week-21_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L30" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-find_beginning_of_week-21_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">find_beginning_of_week!</span>(<span class="ruby-identifier">week_start</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Invalid beginning of week: #{week_start}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-operator">::</span><span class="ruby-constant">Date</span><span class="ruby-operator">::</span><span class="ruby-constant">DAYS_INTO_WEEK</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">week_start</span>)
  <span class="ruby-identifier">week_start</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-tomorrow">
            
              <b>tomorrow</b>()
            
            <a href="Date.html#method-c-tomorrow" name="method-c-tomorrow" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="Date.html">Date</a> representing the date 1 day
after today (i.e. tomorrow’s date).</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-tomorrow_source')" id="l_method-c-tomorrow_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L41" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-tomorrow_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 41</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">tomorrow</span>
  <span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">tomorrow</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-yesterday">
            
              <b>yesterday</b>()
            
            <a href="Date.html#method-c-yesterday" name="method-c-yesterday" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="Date.html">Date</a> representing the date 1 day ago
(i.e. yesterday’s date).</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-yesterday_source')" id="l_method-c-yesterday_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L36" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-yesterday_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 36</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">yesterday</span>
  <span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">current</span>.<span class="ruby-identifier">yesterday</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-3C-3D-3E">
            
              <b>&lt;=&gt;</b>(other)
            
            <a href="Date.html#method-i-3C-3D-3E" name="method-i-3C-3D-3E" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Date.html#method-i-compare_without_coercion">compare_without_coercion</a>
            </div>
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-acts_like_date-3F">
            
              <b>acts_like_date?</b>()
            
            <a href="Date.html#method-i-acts_like_date-3F" name="method-i-acts_like_date-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Duck-types as a Date-like class. See <a
href="Object.html#method-i-acts_like-3F">Object#acts_like?</a>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-acts_like_date-3F_source')" id="l_method-i-acts_like_date-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/609c1988d2e274b365c5299cc5933fb6855e4175/activesupport/lib/active_support/core_ext/date/acts_like.rb#L5" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-acts_like_date-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/acts_like.rb, line 5</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">acts_like_date?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-advance">
            
              <b>advance</b>(options)
            
            <a href="Date.html#method-i-advance" name="method-i-advance" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Provides precise <a href="Date.html">Date</a> calculations for years,
months, and days. The <code>options</code> parameter takes a hash with any
of these keys: <code>:years</code>, <code>:months</code>,
<code>:weeks</code>, <code>:days</code>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-advance_source')" id="l_method-i-advance_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L100" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-advance_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">advance</span>(<span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-identifier">d</span> = <span class="ruby-keyword">self</span>
  <span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span> <span class="ruby-operator">&gt;&gt;</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:years</span>) * <span class="ruby-number">12</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:years</span>]
  <span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span> <span class="ruby-operator">&gt;&gt;</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:months</span>)     <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:months</span>]
  <span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span> <span class="ruby-operator">+</span>  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:weeks</span>) * <span class="ruby-number">7</span>  <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:weeks</span>]
  <span class="ruby-identifier">d</span> = <span class="ruby-identifier">d</span> <span class="ruby-operator">+</span>  <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:days</span>)       <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:days</span>]
  <span class="ruby-identifier">d</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-ago">
            
              <b>ago</b>(seconds)
            
            <a href="Date.html#method-i-ago" name="method-i-ago" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts <a href="Date.html">Date</a> to a <a href="Time.html">Time</a> (or
<a href="DateTime.html">DateTime</a> if necessary) with the time portion
set to the beginning of the day (0:00) and then subtracts the specified
number of seconds.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-ago_source')" id="l_method-i-ago_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L53" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-ago_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">ago</span>(<span class="ruby-identifier">seconds</span>)
  <span class="ruby-identifier">in_time_zone</span>.<span class="ruby-identifier">since</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">seconds</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_beginning_of_day">
            
              <b>at_beginning_of_day</b>()
            
            <a href="Date.html#method-i-at_beginning_of_day" name="method-i-at_beginning_of_day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_end_of_day">
            
              <b>at_end_of_day</b>()
            
            <a href="Date.html#method-i-at_end_of_day" name="method-i-at_end_of_day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-at_midnight">
            
              <b>at_midnight</b>()
            
            <a href="Date.html#method-i-at_midnight" name="method-i-at_midnight" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-beginning_of_day">
            
              <b>beginning_of_day</b>()
            
            <a href="Date.html#method-i-beginning_of_day" name="method-i-beginning_of_day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts <a href="Date.html">Date</a> to a <a href="Time.html">Time</a> (or
<a href="DateTime.html">DateTime</a> if necessary) with the time portion
set to the beginning of the day (0:00)</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Date.html#method-i-midnight">midnight</a>, <a href="Date.html#method-i-at_midnight">at_midnight</a>, <a href="Date.html#method-i-at_beginning_of_day">at_beginning_of_day</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-beginning_of_day_source')" id="l_method-i-beginning_of_day_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L65" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-beginning_of_day_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 65</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">beginning_of_day</span>
  <span class="ruby-identifier">in_time_zone</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-change">
            
              <b>change</b>(options)
            
            <a href="Date.html#method-i-change" name="method-i-change" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns a new <a href="Date.html">Date</a> where one or more of the
elements have been changed according to the <code>options</code> parameter.
The <code>options</code> parameter is a hash with a combination of these
keys: <code>:year</code>, <code>:month</code>, <code>:day</code>.</p>

<pre class="ruby"><span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2007</span>, <span class="ruby-value">5</span>, <span class="ruby-value">12</span>).<span class="ruby-identifier">change</span>(<span class="ruby-identifier">day</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>)               <span class="ruby-comment"># =&gt; Date.new(2007, 5, 1)</span>
<span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2007</span>, <span class="ruby-value">5</span>, <span class="ruby-value">12</span>).<span class="ruby-identifier">change</span>(<span class="ruby-identifier">year</span><span class="ruby-operator">:</span> <span class="ruby-value">2005</span>, <span class="ruby-identifier">month</span><span class="ruby-operator">:</span> <span class="ruby-value">1</span>) <span class="ruby-comment"># =&gt; Date.new(2005, 1, 12)</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-change_source')" id="l_method-i-change_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L115" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-change_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 115</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">change</span>(<span class="ruby-identifier">options</span>)
  <span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:year</span>, <span class="ruby-identifier">year</span>),
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:month</span>, <span class="ruby-identifier">month</span>),
    <span class="ruby-identifier">options</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">:day</span>, <span class="ruby-identifier">day</span>)
  )
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-compare_with_coercion">
            
              <b>compare_with_coercion</b>(other)
            
            <a href="Date.html#method-i-compare_with_coercion" name="method-i-compare_with_coercion" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Allow <a href="Date.html">Date</a> to be compared with <a
href="Time.html">Time</a> by converting to <a
href="DateTime.html">DateTime</a> and relying on the &lt;=&gt; from there.</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Date.html#method-i-3C-3D-3E">&lt;=&gt;</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-compare_with_coercion_source')" id="l_method-i-compare_with_coercion_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L124" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-compare_with_coercion_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 124</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">compare_with_coercion</span>(<span class="ruby-identifier">other</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Time</span>)
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">to_datetime</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">other</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">compare_without_coercion</span>(<span class="ruby-identifier">other</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-compare_without_coercion">
            
              <b>compare_without_coercion</b>(other)
            
            <a href="Date.html#method-i-compare_without_coercion" name="method-i-compare_without_coercion" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-default_inspect">
            
              <b>default_inspect</b>()
            
            <a href="Date.html#method-i-default_inspect" name="method-i-default_inspect" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-end_of_day">
            
              <b>end_of_day</b>()
            
            <a href="Date.html#method-i-end_of_day" name="method-i-end_of_day" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts <a href="Date.html">Date</a> to a <a href="Time.html">Time</a> (or
<a href="DateTime.html">DateTime</a> if necessary) with the time portion
set to the end of the day (23:59:59)</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Date.html#method-i-at_end_of_day">at_end_of_day</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-end_of_day_source')" id="l_method-i-end_of_day_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L73" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-end_of_day_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 73</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">end_of_day</span>
  <span class="ruby-identifier">in_time_zone</span>.<span class="ruby-identifier">end_of_day</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-in">
            
              <b>in</b>(seconds)
            
            <a href="Date.html#method-i-in" name="method-i-in" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-in_time_zone">
            
              <b>in_time_zone</b>(zone = ::Time.zone)
            
            <a href="Date.html#method-i-in_time_zone" name="method-i-in_time_zone" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts <a href="Date.html">Date</a> to a TimeWithZone in the current zone
if <a href="Time.html#method-c-zone">Time.zone</a> or <a
href="Time.html#attribute-c-zone_default">Time.zone_default</a> is set,
otherwise converts <a href="Date.html">Date</a> to a <a
href="Time.html">Time</a> via <a
href="Date.html#method-i-to_time">#to_time</a></p>

<pre class="ruby"><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span> = <span class="ruby-string">'Hawaii'</span>         <span class="ruby-comment"># =&gt; 'Hawaii'</span>
<span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>).<span class="ruby-identifier">in_time_zone</span>  <span class="ruby-comment"># =&gt; Sat, 01 Jan 2000 00:00:00 HST -10:00</span>
</pre>

<p>You can also pass in a TimeZone instance or string that identifies a
TimeZone as an argument, and the conversion will be based on that zone
instead of <code>Time.zone</code>.</p>

<pre class="ruby"><span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2000</span>).<span class="ruby-identifier">in_time_zone</span>(<span class="ruby-string">'Alaska'</span>)  <span class="ruby-comment"># =&gt; Sat, 01 Jan 2000 00:00:00 AKST -09:00</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-in_time_zone_source')" id="l_method-i-in_time_zone_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/224d82ee5990b101b7a44c37bed026b602bd4f20/activesupport/lib/active_support/core_ext/date/zones.rb#L30" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-in_time_zone_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/zones.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">in_time_zone</span>(<span class="ruby-identifier">zone</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">zone</span>
    <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">find_zone!</span>(<span class="ruby-identifier">zone</span>).<span class="ruby-identifier">local</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">to_time</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-inspect">
            
              <b>inspect</b>()
            
            <a href="Date.html#method-i-inspect" name="method-i-inspect" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Date.html#method-i-default_inspect">default_inspect</a>
            </div>
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-midnight">
            
              <b>midnight</b>()
            
            <a href="Date.html#method-i-midnight" name="method-i-midnight" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-readable_inspect">
            
              <b>readable_inspect</b>()
            
            <a href="Date.html#method-i-readable_inspect" name="method-i-readable_inspect" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Overrides the default inspect method with a human readable one, e.g., “Mon,
21 Feb 2005”</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Date.html#method-i-inspect">inspect</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-readable_inspect_source')" id="l_method-i-readable_inspect_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/c6897b7d7b18b5c89aca46d4595b47c2590ce335/activesupport/lib/active_support/core_ext/date/conversions.rb#L62" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-readable_inspect_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/conversions.rb, line 62</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">readable_inspect</span>
  <span class="ruby-identifier">strftime</span>(<span class="ruby-string">'%a, %d %b %Y'</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-since">
            
              <b>since</b>(seconds)
            
            <a href="Date.html#method-i-since" name="method-i-since" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts <a href="Date.html">Date</a> to a <a href="Time.html">Time</a> (or
<a href="DateTime.html">DateTime</a> if necessary) with the time portion
set to the beginning of the day (0:00) and then adds the specified number
of seconds</p>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Date.html#method-i-in">in</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-since_source')" id="l_method-i-since_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/77ac25c6ca42e52c6c42f5aad112dd51c0b0b14b/activesupport/lib/active_support/core_ext/date/calculations.rb#L59" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-since_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/calculations.rb, line 59</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">since</span>(<span class="ruby-identifier">seconds</span>)
  <span class="ruby-identifier">in_time_zone</span>.<span class="ruby-identifier">since</span>(<span class="ruby-identifier">seconds</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_default_s">
            
              <b>to_default_s</b>(format = :default)
            
            <a href="Date.html#method-i-to_default_s" name="method-i-to_default_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_formatted_s">
            
              <b>to_formatted_s</b>(format = :default)
            
            <a href="Date.html#method-i-to_formatted_s" name="method-i-to_formatted_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Convert to a formatted string. See <a
href="Date.html#DATE_FORMATS">DATE_FORMATS</a> for predefined formats.</p>

<p>This method is aliased to <code>to_s</code>.</p>

<pre class="ruby"><span class="ruby-identifier">date</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2007</span>, <span class="ruby-value">11</span>, <span class="ruby-value">10</span>)       <span class="ruby-comment"># =&gt; Sat, 10 Nov 2007</span>

<span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">db</span>)            <span class="ruby-comment"># =&gt; &quot;2007-11-10&quot;</span>
<span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_s</span>(:<span class="ruby-identifier">db</span>)                      <span class="ruby-comment"># =&gt; &quot;2007-11-10&quot;</span>

<span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">short</span>)         <span class="ruby-comment"># =&gt; &quot;10 Nov&quot;</span>
<span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">long</span>)          <span class="ruby-comment"># =&gt; &quot;November 10, 2007&quot;</span>
<span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">long_ordinal</span>)  <span class="ruby-comment"># =&gt; &quot;November 10th, 2007&quot;</span>
<span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_formatted_s</span>(:<span class="ruby-identifier">rfc822</span>)        <span class="ruby-comment"># =&gt; &quot;10 Nov 2007&quot;</span>
</pre>

<h2 id="method-i-to_formatted_s-label-Adding+your+own+time+formats+to+to_formatted_s">Adding your own time formats to <a href="Date.html#method-i-to_formatted_s">#to_formatted_s</a></h2>

<p>You can add your own formats to the Date::DATE_FORMATS hash. Use the format
name as the hash key and either a strftime string or Proc instance that
takes a date argument as the value.</p>

<pre># config/initializers/time_formats.rb
Date::DATE_FORMATS[:month_and_year] = '%B %Y'
Date::DATE_FORMATS[:short_ordinal] = -&gt;(date) { date.strftime(&quot;%B #{date.day.ordinalize}&quot;) }</pre>
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Date.html#method-i-to_s">to_s</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_formatted_s_source')" id="l_method-i-to_formatted_s_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/c6897b7d7b18b5c89aca46d4595b47c2590ce335/activesupport/lib/active_support/core_ext/date/conversions.rb#L47" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_formatted_s_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/conversions.rb, line 47</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_formatted_s</span>(<span class="ruby-identifier">format</span> = <span class="ruby-value">:default</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">formatter</span> = <span class="ruby-constant">DATE_FORMATS</span>[<span class="ruby-identifier">format</span>]
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:call</span>)
      <span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">call</span>(<span class="ruby-keyword">self</span>).<span class="ruby-identifier">to_s</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">strftime</span>(<span class="ruby-identifier">formatter</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">to_default_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_s">
            
              <b>to_s</b>(format = :default)
            
            <a href="Date.html#method-i-to_s" name="method-i-to_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="Date.html#method-i-to_default_s">to_default_s</a>
            </div>
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_time">
            
              <b>to_time</b>(form = :local)
            
            <a href="Date.html#method-i-to_time" name="method-i-to_time" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Converts a <a href="Date.html">Date</a> instance to a <a
href="Time.html">Time</a>, where the time is set to the beginning of the
day. The timezone can be either :local or :utc (default :local).</p>

<pre class="ruby"><span class="ruby-identifier">date</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">2007</span>, <span class="ruby-value">11</span>, <span class="ruby-value">10</span>)  <span class="ruby-comment"># =&gt; Sat, 10 Nov 2007</span>

<span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_time</span>                   <span class="ruby-comment"># =&gt; Sat Nov 10 00:00:00 0800 2007</span>
<span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_time</span>(:<span class="ruby-identifier">local</span>)           <span class="ruby-comment"># =&gt; Sat Nov 10 00:00:00 0800 2007</span>

<span class="ruby-identifier">date</span>.<span class="ruby-identifier">to_time</span>(:<span class="ruby-identifier">utc</span>)             <span class="ruby-comment"># =&gt; Sat Nov 10 00:00:00 UTC 2007</span>
</pre>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_time_source')" id="l_method-i-to_time_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/c6897b7d7b18b5c89aca46d4595b47c2590ce335/activesupport/lib/active_support/core_ext/date/conversions.rb#L77" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_time_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/conversions.rb, line 77</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_time</span>(<span class="ruby-identifier">form</span> = <span class="ruby-value">:local</span>)
  <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">form</span>, <span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_time_in_current_zone">
            
              <b>to_time_in_current_zone</b>()
            
            <a href="Date.html#method-i-to_time_in_current_zone" name="method-i-to_time_in_current_zone" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p><strong>DEPRECATED</strong>: Use +<a
href="Date.html#method-i-in_time_zone">#in_time_zone</a>+ instead.</p>

<p>Converts <a href="Date.html">Date</a> to a TimeWithZone in the current zone
if <code>Time.zone</code> or <code>Time.zone_default</code> is set,
otherwise converts <a href="Date.html">Date</a> to a <a
href="Time.html">Time</a> via <a
href="Date.html#method-i-to_time">#to_time</a>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_time_in_current_zone_source')" id="l_method-i-to_time_in_current_zone_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/224d82ee5990b101b7a44c37bed026b602bd4f20/activesupport/lib/active_support/core_ext/date/zones.rb#L10" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_time_in_current_zone_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/zones.rb, line 10</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_time_in_current_zone</span>
  <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Deprecation</span>.<span class="ruby-identifier">warn</span> <span class="ruby-string">'Date#to_time_in_current_zone is deprecated. Use Date#in_time_zone instead'</span>, <span class="ruby-identifier">caller</span>

  <span class="ruby-keyword">if</span> <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span>
    <span class="ruby-operator">::</span><span class="ruby-constant">Time</span>.<span class="ruby-identifier">zone</span>.<span class="ruby-identifier">local</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">to_time</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-xmlschema">
            
              <b>xmlschema</b>()
            
            <a href="Date.html#method-i-xmlschema" name="method-i-xmlschema" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-xmlschema_source')" id="l_method-i-xmlschema_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/c6897b7d7b18b5c89aca46d4595b47c2590ce335/activesupport/lib/active_support/core_ext/date/conversions.rb#L81" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-xmlschema_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/date/conversions.rb, line 81</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">xmlschema</span>
  <span class="ruby-identifier">in_time_zone</span>.<span class="ruby-identifier">xmlschema</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    